Skip to content

[PE-94] refactor: remove cn helper function from the editor package #6217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Dec 17, 2024

Description

This PR removes the cn helper function declaration from the editor package and adds it to the utils package.

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features

    • Enhanced image handling and resizing in the CustomImageBlock component.
    • Improved logo selection logic in the CalloutBlockLogoSelector component.
  • Bug Fixes

    • Adjusted identifier field validation in ProjectCommonAttributes to allow only valid characters.
  • Documentation

    • Updated comments for clarity regarding import sources and component functionality.
  • Refactor

    • Reorganized import statements across multiple components to source utilities from @plane/utils.
  • Style

    • Updated class name management through the new cn utility across various components.
  • Chores

    • Added new dependencies (clsx and tailwind-merge) to the @plane/utils package.

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

This pull request introduces a comprehensive refactoring of utility imports across multiple packages, primarily focusing on moving the cn (class name) utility function from @plane/editor to @plane/utils. The changes involve updating import statements in numerous components, adding new dependencies to the @plane/utils package like clsx and tailwind-merge, and removing these dependencies from the @plane/editor package. The modifications span across editor, space, and web components, ensuring consistent utility function usage.

Changes

File/Directory Change Summary
packages/editor/package.json Removed clsx and tailwind-merge dependencies
packages/utils/package.json Added clsx and tailwind-merge dependencies
packages/utils/src/common.ts Added new cn utility function implementation
packages/utils/src/index.ts Added export for common utilities
Multiple components Updated cn import from @plane/editor to @plane/utils

Sequence Diagram

sequenceDiagram
    participant Developer
    participant EditorPackage
    participant UtilsPackage
    participant Components

    Developer->>EditorPackage: Remove cn utility
    Developer->>UtilsPackage: Add cn utility implementation
    Developer->>Components: Update import statements
    Components->>UtilsPackage: Import cn function
    UtilsPackage-->>Components: Provide cn utility
Loading

Possibly related PRs

Suggested labels

✍️editor, 🌟enhancement, 🎨UI / UX

Suggested reviewers

  • SatishGandham
  • pushya22

Poem

🐰 A Rabbit's Refactoring Tale 🐰

Imports dancing, utilities bright,
From editor to utils, a refactoring delight!
cn function hopping to a new home,
Cleaner code structure, no more to roam.
Utility magic, with a bunny's glee! 🎩✨

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aaryan610 aaryan610 changed the title refactor: remove cn helper function from the editor package [PE-94] refactor: remove cn helper function from the editor package Dec 17, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (6)
packages/utils/src/common.ts (1)

1-4: LGTM! Clean implementation of the cn utility.

The implementation correctly combines clsx for class name composition and tailwind-merge for Tailwind CSS class deduplication. The function is properly typed and exported.

Consider adding these dependencies to the project's root package.json as peer dependencies to ensure consistent versioning across packages.

web/core/components/workspace/logo.tsx (1)

Line range hint 14-19: Simplify class name construction.

The current implementation uses template literals inside cn(), which is redundant since cn() already handles class name concatenation.

Consider refactoring to:

-    className={cn(
-      `relative grid h-6 w-6 flex-shrink-0 place-items-center uppercase ${
-        !props.logo && "rounded bg-custom-primary-500 text-white"
-      } ${props.classNames ? props.classNames : ""}`
-    )}
+    className={cn(
+      "relative grid h-6 w-6 flex-shrink-0 place-items-center uppercase",
+      !props.logo && "rounded bg-custom-primary-500 text-white",
+      props.classNames
+    )}
packages/editor/src/core/extensions/mentions/mention-node-view.tsx (1)

Line range hint 1-5: Consider addressing code quality issues

The file contains multiple code quality suppressions that should be addressed:

  • TODO comment without specific tracking
  • Multiple eslint-disable directives
  • TypeScript type checking completely disabled

Consider:

  1. Creating specific issues for the TODO items
  2. Addressing eslint warnings instead of disabling them
  3. Enabling TypeScript type checking and fixing type issues
web/core/components/dropdowns/layout.tsx (1)

Line range hint 76-76: Consider improving type safety of keyExtractor

The keyExtractor callback uses any type which could be made more type-safe.

-  const keyExtractor = useCallback((option: any) => option.value, []);
+  const keyExtractor = useCallback((option: { value: string }) => option.value, []);
packages/editor/src/core/components/editors/editor-container.tsx (1)

3-4: LGTM! Consider grouping related imports.

The import change correctly moves the cn utility to @plane/utils. Consider grouping all utility imports together for better code organization.

import { FC, ReactNode } from "react";
import { Editor } from "@tiptap/react";

-// plane utils
-import { cn } from "@plane/utils";
// constants
import { DEFAULT_DISPLAY_CONFIG } from "@/constants/config";
// types
import { TDisplayConfig } from "@/types";
+// plane utils
+import { cn } from "@plane/utils";
packages/editor/src/core/extensions/custom-image/components/image-block.tsx (1)

3-4: LGTM! Import changes align with refactoring objective.

The change to import cn from @plane/utils is consistent with the PR's goal of relocating utility functions.

Consider grouping all utility imports together at the top of the file, before component-specific imports, to maintain a consistent import organization pattern across the codebase.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ddd4b51 and 96ae1cf.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (49)
  • packages/editor/package.json (0 hunks)
  • packages/editor/src/core/components/editors/editor-container.tsx (1 hunks)
  • packages/editor/src/core/components/menus/ai-menu.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/alignment-selector.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/color-selector.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/link-selector.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/node-selector.tsx (1 hunks)
  • packages/editor/src/core/components/menus/bubble-menu/root.tsx (1 hunks)
  • packages/editor/src/core/extensions/callout/color-selector.tsx (1 hunks)
  • packages/editor/src/core/extensions/callout/logo-selector.tsx (1 hunks)
  • packages/editor/src/core/extensions/code/code-block-node-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/image-block.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/image-uploader.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/toolbar/root.tsx (1 hunks)
  • packages/editor/src/core/extensions/mentions/mention-node-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/mentions/mentions-list.tsx (1 hunks)
  • packages/editor/src/core/extensions/slash-commands/command-menu-item.tsx (1 hunks)
  • packages/editor/src/core/helpers/common.ts (1 hunks)
  • packages/editor/src/core/props/props.tsx (1 hunks)
  • packages/editor/src/core/props/read-only.tsx (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/utils/src/common.ts (1 hunks)
  • packages/utils/src/index.ts (1 hunks)
  • space/core/components/issues/issue-layouts/kanban/block-reactions.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/kanban/block.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/list/block.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/list/list-group.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/properties/all-properties.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/properties/cycle.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/properties/member.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/properties/modules.tsx (1 hunks)
  • space/core/components/issues/issue-layouts/properties/state.tsx (1 hunks)
  • web/ce/components/workflow/add-state-transition.tsx (1 hunks)
  • web/core/components/common/access-field.tsx (1 hunks)
  • web/core/components/dropdowns/layout.tsx (1 hunks)
  • web/core/components/dropdowns/member/avatar.tsx (1 hunks)
  • web/core/components/gantt-chart/chart/views/quarter.tsx (1 hunks)
  • web/core/components/gantt-chart/chart/views/week.tsx (1 hunks)
  • web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx (1 hunks)
  • web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx (1 hunks)
  • web/core/components/inbox/inbox-filter/root.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/list/list-group.tsx (2 hunks)
  • web/core/components/modules/module-view-header.tsx (1 hunks)
  • web/core/components/project/create/common-attributes.tsx (1 hunks)
  • web/core/components/project/filters.tsx (1 hunks)
  • web/core/components/ui/loader/layouts/kanban-layout-loader.tsx (1 hunks)
  • web/core/components/ui/loader/layouts/list-layout-loader.tsx (1 hunks)
  • web/core/components/workspace/logo.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/editor/package.json
✅ Files skipped from review due to trivial changes (12)
  • packages/utils/src/index.ts
  • packages/editor/src/core/components/menus/bubble-menu/node-selector.tsx
  • space/core/components/issues/issue-layouts/kanban/block-reactions.tsx
  • packages/editor/src/core/extensions/custom-image/components/toolbar/root.tsx
  • web/core/components/dropdowns/member/avatar.tsx
  • packages/editor/src/core/components/menus/bubble-menu/link-selector.tsx
  • packages/editor/src/core/props/props.tsx
  • space/core/components/issues/issue-layouts/properties/modules.tsx
  • web/core/components/gantt-chart/helpers/blockResizables/right-resizable.tsx
  • web/core/components/inbox/inbox-filter/root.tsx
  • web/core/components/project/filters.tsx
  • space/core/components/issues/issue-layouts/list/block.tsx
🔇 Additional comments (39)
packages/editor/src/core/props/read-only.tsx (1)

2-3: LGTM! Import path correctly updated.

The import has been properly updated to use the centralized utility from @plane/utils.

Let's verify that all references to the old import path have been updated:

✅ Verification successful

Import path update needs attention

The verification revealed multiple files still using the cn function, but we need to check their import sources to ensure they're all using @plane/utils. Let's verify the import sources specifically:


Import path update successfully verified

All files in the editor package that use the cn function are correctly importing it from @plane/utils. The migration of this utility function has been completed successfully across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining imports of cn from the editor package
rg -l "import.*\{.*cn.*\}.*from.*@/helpers/common" packages/editor/
rg -l "import.*\{.*cn.*\}.*from.*@plane/editor" 

Length of output: 119


Script:

#!/bin/bash
# Let's try a broader search for cn imports in the editor package
rg -l "import.*cn.*from" packages/editor/

# Also search for any remaining references to @/helpers/common
rg -l "@/helpers/common" packages/editor/

# And check for any direct usage of cn function
rg "cn\(" packages/editor/

Length of output: 5020


Script:

#!/bin/bash
# Check the import statements for cn in all identified files
for file in $(rg -l "import.*cn.*from" packages/editor/); do
  echo "=== $file ==="
  rg "import.*cn.*from" "$file"
done

Length of output: 6849

web/ce/components/workflow/add-state-transition.tsx (1)

2-3: LGTM! Import path correctly updated.

The import has been properly updated to use the centralized utility from @plane/utils, maintaining consistent usage across the codebase.

web/core/components/workspace/logo.tsx (1)

1-2: LGTM! Import change aligns with refactoring objective.

The import statement has been correctly updated to use cn from @plane/utils.

packages/utils/package.json (1)

18-21: LGTM! Dependencies correctly added for cn utility.

The required dependencies clsx and tailwind-merge have been properly added with appropriate version constraints.

space/core/components/issues/issue-layouts/properties/state.tsx (2)

6-7: LGTM! Clean implementation of cn utility.

The import has been correctly updated, and the usage of cn() with conditional classes is well-implemented.


1-1: Verify complete migration of cn utility.

Let's ensure all imports of the cn utility have been updated across the codebase.

✅ Verification successful

Migration of cn utility is complete

All imports of cn utility are now consistently imported from @plane/utils. No remaining imports from @plane/editor were found in the codebase, confirming successful migration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining imports of cn from @plane/editor
rg "import.*\{.*cn.*\}.*from.*@plane/editor"

# Search for new imports of cn from @plane/utils to confirm migration
rg "import.*\{.*cn.*\}.*from.*@plane/utils"

Length of output: 4430

packages/editor/src/core/extensions/slash-commands/command-menu-item.tsx (1)

1-2: LGTM! Import changes align with refactoring objectives.

The import statement has been correctly updated to use cn from @plane/utils, aligning with the PR's goal of centralizing utility functions.

space/core/components/issues/issue-layouts/properties/cycle.tsx (1)

4-7: LGTM! Well-organized import structure.

The imports are properly organized with clear section comments, and the cn utility has been correctly moved to @plane/utils.

packages/editor/src/core/extensions/mentions/mention-node-view.tsx (1)

8-9: LGTM: Import change aligns with refactoring objective

The cn import has been correctly moved from local helpers to @plane/utils.

web/core/components/ui/loader/layouts/kanban-layout-loader.tsx (1)

3-6: LGTM: Import changes align with refactoring objective

The changes appropriately:

  • Move cn import to @plane/utils
  • Add ContentWrapper from @plane/ui
packages/editor/src/core/helpers/common.ts (2)

2-3: LGTM: Successfully removed local cn implementation

The cn function has been correctly moved to @plane/utils and is now imported from there.


Line range hint 11-19: Verify usage of imported cn function

The getEditorClassNames function now uses the imported cn utility. Let's verify that all other files depending on this function are updated accordingly.

web/core/components/gantt-chart/helpers/blockResizables/left-resizable.tsx (1)

3-4: LGTM: Import path updated correctly

The import statement for the cn function has been properly updated to use @plane/utils, aligning with the PR's objective of relocating utility functions.

packages/editor/src/core/extensions/code/code-block-node-view.tsx (1)

11-12: LGTM: Import statement updated with clear organization

The import statement for the cn function has been properly updated to use @plane/utils, with a clear comment indicating the utility imports section.

packages/editor/src/core/components/menus/bubble-menu/alignment-selector.tsx (1)

3-4: LGTM: Import updated consistently

The import statement for the cn function has been properly updated to use @plane/utils, maintaining consistency with other files in the codebase.

Let's verify that all instances of the cn function import have been updated consistently:

✅ Verification successful

LGTM: Import statement is correctly updated and consistent

The import of cn from @plane/utils in alignment-selector.tsx is consistent with other files in the editor package. All editor components are using the same import path @plane/utils for the cn utility function, showing proper standardization across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports of `cn` from @plane/editor
# or other local paths to ensure complete migration

echo "Checking for any remaining old cn imports..."
rg -l "import.*\{.*cn.*\}.*from.*(?!@plane/utils)" --type ts --type tsx

echo "Verifying new cn imports..."
rg -l "import.*\{.*cn.*\}.*from.*@plane/utils" --type ts --type tsx

Length of output: 607


Script:

#!/bin/bash
# Let's try a simpler approach to find cn imports

echo "Checking all cn imports in the codebase..."
rg "import.*cn.*from" --type typescript --type-add 'typescript:*.{ts,tsx}'

echo -e "\nChecking usage of cn function in the current file..."
rg "cn\(" "packages/editor/src/core/components/menus/bubble-menu/alignment-selector.tsx"

Length of output: 30902

space/core/components/issues/issue-layouts/properties/member.tsx (1)

9-9: LGTM! Import change aligns with refactoring objective

The change correctly imports cn from @plane/utils, consistent with the PR's goal of relocating the utility function.

packages/editor/src/core/components/menus/ai-menu.tsx (1)

3-4: LGTM! Verify popup functionality remains intact

The import change correctly moves cn to @plane/utils. Since this component handles complex popup behavior, it would be good to verify the functionality remains unchanged.

web/core/components/dropdowns/layout.tsx (1)

4-7: LGTM! Import organization follows best practices

The imports are well-organized with clear sectioning, and the changes align with the PR's objective of relocating the cn utility.

packages/editor/src/core/extensions/callout/color-selector.tsx (1)

2-3: LGTM! Import change aligns with PR objectives.

The change correctly moves the cn utility import from local helpers to @plane/utils package.

Let's verify all usages of the cn function in this file are working as expected:

✅ Verification successful

Let me verify the implementation of cn in @plane/utils to ensure it matches the usage pattern shown in the results.


Let me try a different approach to locate and verify the cn utility implementation.


Let me try one final approach to locate the utility in the utils package.


Import change is correctly implemented and widely used across the codebase

The cn utility is properly exported from @plane/utils package as a class merging utility using twMerge and clsx. The usage in color-selector.tsx follows the same pattern as numerous other files across the codebase that have already adopted this utility from @plane/utils.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify cn function usage patterns
# Look for any potential issues in className concatenation patterns

rg "cn\(" "packages/editor/src/core/extensions/callout/color-selector.tsx" -A 1

Length of output: 505


Script:

#!/bin/bash
# Check the implementation of cn function in @plane/utils
ast-grep --pattern 'export function cn($$$)'

# Also check if there are any other files using cn from @plane/utils
rg "from \"@plane/utils\".*cn" -A 1

Length of output: 82


Script:

#!/bin/bash
# Find cn implementation in utils package
fd "cn.ts" --type f

# Look for any cn function definition
rg "function cn" --type ts

Length of output: 48


Script:

#!/bin/bash
# Look for cn export in utils package
fd . packages/ui/src packages/utils/src -t f -e ts -e tsx | xargs rg "export.*cn"

# Also check for any imports of cn from @plane/utils
rg "import.*cn.*@plane/utils" --type ts

Length of output: 4562

web/core/components/ui/loader/layouts/list-layout-loader.tsx (2)

3-4: LGTM! Proper UI component import.

The Row component is correctly imported from @plane/ui package.


5-6: LGTM! Import change aligns with PR objectives.

The cn utility is correctly moved from @plane/editor to @plane/utils package.

Let's verify there are no remaining references to the old import:

✅ Verification successful

Let me verify if there are any remaining imports of cn specifically from @plane/editor:


Import migration from @plane/editor to @plane/utils is complete

The verification confirms that there are no remaining imports of cn from @plane/editor. While there are other imports from @plane/editor package (like EditorRefApi, etc.), none of them include the cn utility, confirming its successful migration to @plane/utils.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to cn from @plane/editor
# This helps ensure the migration is complete

rg "from\s+['\"]@plane/editor['\"]" "web/core/components/"

Length of output: 3289


Script:

#!/bin/bash
# Search for any remaining imports of 'cn' from @plane/editor
rg "import.*\{.*\bcn\b.*\}.*from.*['\"]@plane/editor['\"]"

Length of output: 64

packages/editor/src/core/extensions/callout/logo-selector.tsx (1)

5-6: LGTM: Import statement correctly updated

The cn utility function is now correctly imported from @plane/utils package, aligning with the refactoring objective.

space/core/components/issues/issue-layouts/kanban/block.tsx (1)

11-12: LGTM: Import statement correctly updated

The cn utility function is now correctly imported from @plane/utils package, maintaining all existing functionality.

web/core/components/gantt-chart/chart/views/week.tsx (1)

3-4: LGTM: Import statement correctly updated

The cn utility function is now correctly imported from @plane/utils package.

Let's verify that all imports of cn from @plane/editor have been updated:

✅ Verification successful

Import change verified and no remaining references found

The verification confirms that the cn utility function is correctly imported from @plane/utils in the file, and there are no remaining imports of cn from @plane/editor. The codebase scan shows that all usages of cn are properly imported from @plane/utils.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports of cn from @plane/editor
# Expected: No results, as all imports should be updated to @plane/utils

rg "import.*\{.*cn.*\}.*from.*@plane/editor"

Length of output: 46


Script:

#!/bin/bash
# Let's verify both old and new imports comprehensively

# Check for any imports from @plane/editor that might contain cn
echo "=== Checking @plane/editor imports ==="
rg -l "@plane/editor"

# Check current usage of cn from @plane/utils
echo -e "\n=== Checking @plane/utils cn imports ==="
rg "import.*\{.*cn.*\}.*from.*@plane/utils"

# Check all occurrences of cn function usage to ensure alignment
echo -e "\n=== Checking cn function usage ==="
rg "cn\("

Length of output: 72748

web/core/components/gantt-chart/chart/views/quarter.tsx (1)

3-4: LGTM: Import change aligns with refactoring objective

The import statement has been correctly updated to use cn from @plane/utils, maintaining the same functionality while improving code organization.

packages/editor/src/core/components/menus/bubble-menu/color-selector.tsx (1)

4-5: LGTM: Verify editor package dependencies

The import has been correctly updated to use cn from @plane/utils. Since this file is in the editor package where cn was originally located, ensure the editor package's dependencies are updated accordingly.

✅ Verification successful

Dependencies updated correctly and no residual imports found

The verification confirms:

  • @plane/utils is correctly added as a dependency in the editor package
  • No remaining imports of cn from the editor package
  • No residual cn function definitions in the editor package
  • The only cn declarations found are in the expected locations (@plane/utils, @plane/ui, and other packages)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that @plane/editor package.json has been updated
# Expected: No direct dependencies on clsx or tailwind-merge, and @plane/utils added as dependency

# Check editor package dependencies
cat packages/editor/package.json | jq '.dependencies'

# Verify no other usages of cn helper in editor package
rg -g '!package.json' -g '!package-lock.json' "from \"@plane/editor.*cn\"" 

Length of output: 1391


Script:

#!/bin/bash
# Let's verify if there are any remaining imports of 'cn' from the editor package
rg "from ['\"]@plane/editor.*cn['\"]"

# Also check for any direct imports of cn from the editor's utils
rg "from ['\"].*editor/.*utils.*cn['\"]"

# Let's also check for any remaining cn function definitions in the editor package
ast-grep --pattern 'function cn($_) { $$$ }'

# And check for any remaining cn const declarations
ast-grep --pattern 'const cn = $_'

Length of output: 679

space/core/components/issues/issue-layouts/list/list-group.tsx (3)

7-8: LGTM: Import change aligns with refactoring objective

The import statement has been correctly updated to use cn from @plane/utils, maintaining the same functionality while improving code organization.


Line range hint 1-1: Verify completeness of cn helper function migration

Let's ensure all instances of the cn helper function have been migrated from the editor package.

✅ Verification successful

Migration of cn helper function is complete and correctly implemented

The verification confirms:

  • No remaining imports of cn from @plane/editor package
  • The cn utility is properly exported from @plane/utils/src/common.ts
  • All previous usages have been successfully migrated
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify complete migration of cn helper function
# Expected: No remaining imports of cn from editor package

# Check for any remaining imports from @plane/editor that include cn
rg -g '!*.md' -g '!package*.json' "from.*@plane/editor.*\{.*cn.*\}"

# Check for any direct usage of cn from editor
rg -g '!*.md' -g '!package*.json' "from.*@plane/editor/.*cn"

# Verify cn is exported from utils
rg -g '!*.md' -g '!package*.json' "export.*cn" packages/utils/

Length of output: 296


5-6: Query: Unrelated type import changes

The addition of type imports from @plane/types appears unrelated to the cn helper function refactoring. Could you clarify if this change is intentional or if it should be part of a separate PR?

packages/editor/src/core/extensions/mentions/mentions-list.tsx (1)

8-9: LGTM: Import change aligns with refactoring objectives

The update to import cn from @plane/utils is consistent with the PR's goal of relocating utility functions to a centralized location.

web/core/components/project/create/common-attributes.tsx (2)

4-4: LGTM: Comment update improves clarity

The comment update from "// ui" to "// plane ui" better reflects the package origin.


6-7: LGTM: Import change aligns with refactoring objectives

The update to import cn from @plane/utils is consistent with the PR's goal of centralizing utility functions.

packages/editor/src/core/components/menus/bubble-menu/root.tsx (1)

3-4: LGTM: Import change and comment addition improve code organization

The update to import cn from @plane/utils aligns with the PR's refactoring goals, and the added comment helps categorize the imports clearly.

packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen.tsx (1)

3-4: LGTM: Import change aligns with refactoring objectives

The change to import cn from @plane/utils is consistent with the PR's goal of centralizing utility functions.

packages/editor/src/core/extensions/custom-image/components/image-uploader.tsx (1)

3-4: LGTM: Import change aligns with refactoring objectives

The change to import cn from @plane/utils is consistent with the PR's goal of centralizing utility functions. The complex conditional class name concatenation remains intact and functional.

web/core/components/modules/module-view-header.tsx (1)

7-8: LGTM: Import change aligns with refactoring objectives

The change to import cn from @plane/utils is consistent with the PR's goal of centralizing utility functions.

Let's verify that all imports of cn have been updated consistently across the codebase:

✅ Verification successful

Import changes are consistent across the codebase

The verification shows that:

  • No instances of cn being imported from @plane/editor were found
  • All imports of cn are now consistently from @plane/utils
  • The change in module-view-header.tsx aligns with the pattern seen across 44 other files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports of cn from @plane/editor
# Expected: No results, as all imports should now be from @plane/utils

echo "Checking for remaining imports from @plane/editor..."
rg "import.*\{.*cn.*\}.*from.*@plane/editor"

echo "Verifying new imports from @plane/utils..."
rg "import.*\{.*cn.*\}.*from.*@plane/utils"

Length of output: 4640

space/core/components/issues/issue-layouts/properties/all-properties.tsx (1)

9-10: LGTM! Import changes align with refactoring objective.

The change to import cn from @plane/utils is consistent with the PR's goal of relocating utility functions.

web/core/components/issues/issue-layouts/list/list-group.tsx (1)

18-19: LGTM! Import changes align with refactoring objective.

The change to import cn from @plane/utils is consistent with the PR's goal of relocating utility functions.

packages/editor/src/core/extensions/custom-image/components/image-block.tsx (1)

3-4: Verify consistent usage of relocated cn function.

Let's ensure there are no remaining references to the old import path and that the new import path is used consistently across the codebase.

Also applies to: 18-19, 9-10

✅ Verification successful

No inconsistencies found in cn function imports

The verification shows that:

  1. There are no remaining imports of cn from @plane/editor
  2. All imports in the editor package correctly use @plane/utils
  3. Other imports of cn are either from @plane/utils or from local helper files (@/helpers/common.helper), which is the expected pattern
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old imports of cn function and verify consistent usage of new import path

# Check for any remaining old imports from editor package
echo "Checking for old imports..."
rg -l "import.*\{.*cn.*\}.*from.*@plane/editor"

# Check for new imports to ensure consistency
echo "Verifying new imports..."
rg -l "import.*\{.*cn.*\}.*from.*@plane/utils"

# Check for any other potential cn imports that might need updating
echo "Checking for other cn imports that might need review..."
rg -l "import.*\{.*cn.*\}.*from" --type ts --type tsx

Length of output: 3190


Script:

#!/bin/bash
# Let's modify the search to handle TypeScript/TSX files correctly and get more context

# Check for any remaining old imports
echo "Checking for old imports..."
rg "import.*\{.*cn.*\}.*from.*@plane/editor" -t typescript -t tsx

# Check for new imports to ensure consistency
echo "Verifying new imports..."
rg "import.*\{.*cn.*\}.*from.*@plane/utils" -t typescript -t tsx

# Check for any other cn imports with context
echo "Checking for other cn imports..."
rg "import.*\{.*cn.*\}.*from" -t typescript -t tsx

Length of output: 491


Script:

#!/bin/bash
# Let's try without file type specifications since ripgrep should automatically detect them

# Check for any remaining old imports with context
echo "Checking for old imports..."
rg "import.*\{.*cn.*\}.*from.*@plane/editor" --type-add 'ts:*.{ts,tsx}' -t ts

# Check for new imports pattern
echo "Verifying new imports..."
rg "import.*\{.*cn.*\}.*from.*@plane/utils" --type-add 'ts:*.{ts,tsx}' -t ts

# Look for any other variations of cn imports
echo "Checking for other cn imports..."
rg "import.*cn.*from" --type-add 'ts:*.{ts,tsx}' -t ts

Length of output: 35248

Comment on lines +2 to +5
// plane ui
import { Tooltip } from "@plane/ui";
// plane utils
import { cn } from "@plane/utils";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistent imports found - cn utility is still imported from old locations

Several files are still importing cn from @plane/editor or @/helpers, indicating incomplete migration:

  • web/core/components/workspace-notifications/**/*.tsx
  • web/core/components/issues/select/label.tsx
  • web/core/components/issues/workspace-draft/**/*.tsx
  • web/core/components/issues/title-input.tsx
  • web/core/components/issues/sub-issues/issue-list-item.tsx
  • web/core/components/issues/peek-overview/**/*.tsx

These files need to be updated to import cn from @plane/utils to maintain consistency with the refactoring.

🔗 Analysis chain

LGTM! Import changes are consistent with the refactoring pattern.

The import changes maintain consistency with the project-wide refactoring of moving the cn utility to @plane/utils.

Let's verify that all imports of cn have been updated consistently across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports of cn from @plane/editor
# or local helpers to ensure complete migration

echo "Checking for any remaining old cn imports..."
rg -l "import.*\{.*cn.*\}.*from.*(@plane/editor|@/helpers)" || echo "No old imports found!"

echo "Verifying new cn imports..."
rg -l "import.*\{.*cn.*\}.*from.*@plane/utils"

Length of output: 15523

@SatishGandham SatishGandham merged commit 580c4b1 into preview Dec 18, 2024
12 of 14 checks passed
@SatishGandham SatishGandham deleted the refactor/editor-helper branch December 18, 2024 06:52
sriramveeraghanta added a commit that referenced this pull request Jan 3, 2025
* fix: adding language support package

* fix: language support implementation using mobx

* fix: adding more languages for support

* fix: profile settings translations

* feat: added language support for sidebar and user settings

* feat: added language support for deactivation modal

* fix: added project sync after transfer issues (#6200)

* code refactor and improvement (#6203)

* chore: package code refactoring

* chore: component restructuring and refactor

* chore: comment create improvement

* refactor: enhance workspace and project wrapper modularity (#6207)

* [WEB-2678]feat: added functionality to add labels directly from dropdown (#6211)

* enhancement:added functionality to add features directly from dropdown

* fix: fixed import order

* fix: fixed lint errors

* chore: added common component for project activity (#6212)

* chore: added common component for project activity

* fix: added enum

* fix: added enum for initiatives

* - Do not clear temp files that are locked. (#6214)

- Handle edge cases in sync workspace

* fix: labels empty state for drop down (#6216)

* refactor: remove cn helper function from the editor package (#6217)

* * feat: added language support to issue create modal in sidebar
* fix: project activity type

* * fix: added missing translations
* fix: modified translation for plurals

* fix: fixed spanish translation

* dev: language type error in space user profile types

* fix: type fixes

* chore: added alpha tag

---------

Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: gurusinath <[email protected]>
sangeethailango pushed a commit that referenced this pull request Jan 3, 2025
* fix: adding language support package

* fix: language support implementation using mobx

* fix: adding more languages for support

* fix: profile settings translations

* feat: added language support for sidebar and user settings

* feat: added language support for deactivation modal

* fix: added project sync after transfer issues (#6200)

* code refactor and improvement (#6203)

* chore: package code refactoring

* chore: component restructuring and refactor

* chore: comment create improvement

* refactor: enhance workspace and project wrapper modularity (#6207)

* [WEB-2678]feat: added functionality to add labels directly from dropdown (#6211)

* enhancement:added functionality to add features directly from dropdown

* fix: fixed import order

* fix: fixed lint errors

* chore: added common component for project activity (#6212)

* chore: added common component for project activity

* fix: added enum

* fix: added enum for initiatives

* - Do not clear temp files that are locked. (#6214)

- Handle edge cases in sync workspace

* fix: labels empty state for drop down (#6216)

* refactor: remove cn helper function from the editor package (#6217)

* * feat: added language support to issue create modal in sidebar
* fix: project activity type

* * fix: added missing translations
* fix: modified translation for plurals

* fix: fixed spanish translation

* dev: language type error in space user profile types

* fix: type fixes

* chore: added alpha tag

---------

Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: gurusinath <[email protected]>
sriramveeraghanta added a commit that referenced this pull request Jan 6, 2025
* WIP

* WIP

* WIP

* WIP

* Create home preference if not exist

* chore: handled the unique state name validation (#6299)

* fix: changed the response structure (#6301)

* [WEB-1964]chore: cycles actions restructuring (#6298)

* chore: cycles quick actions restructuring

* chore: added additional actions to cycle list actions

* chore: cycle quick action structure

* chore: added additional actions to cycle list actions

* chore: added end cycle hook

* fix: updated end cycle export

---------

Co-authored-by: gurusinath <[email protected]>

* fix: active cycle graph tooltip and endpoint validation (#6306)

* [WEB-2870]feat: language support (#6215)

* fix: adding language support package

* fix: language support implementation using mobx

* fix: adding more languages for support

* fix: profile settings translations

* feat: added language support for sidebar and user settings

* feat: added language support for deactivation modal

* fix: added project sync after transfer issues (#6200)

* code refactor and improvement (#6203)

* chore: package code refactoring

* chore: component restructuring and refactor

* chore: comment create improvement

* refactor: enhance workspace and project wrapper modularity (#6207)

* [WEB-2678]feat: added functionality to add labels directly from dropdown (#6211)

* enhancement:added functionality to add features directly from dropdown

* fix: fixed import order

* fix: fixed lint errors

* chore: added common component for project activity (#6212)

* chore: added common component for project activity

* fix: added enum

* fix: added enum for initiatives

* - Do not clear temp files that are locked. (#6214)

- Handle edge cases in sync workspace

* fix: labels empty state for drop down (#6216)

* refactor: remove cn helper function from the editor package (#6217)

* * feat: added language support to issue create modal in sidebar
* fix: project activity type

* * fix: added missing translations
* fix: modified translation for plurals

* fix: fixed spanish translation

* dev: language type error in space user profile types

* fix: type fixes

* chore: added alpha tag

---------

Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: gurusinath <[email protected]>

* feat: introduced stacked bar chart and tree map chart. (#6305)

* feat: add issue attachment external endpoint (#6307)

* [PE-97] chore: re-order pages options (#6303)

* chore: re-order pages dropdown options

* chore: re-order pages dropdown options

* fix: remove localdb tracing

* [WEB-2937] feat: home recent activies list endpoint (#6295)

* Crud for wuick links

* Validate quick link existence

* Add custom method for destroy and retrieve

* Add List method

* Remove print statements

* List all the workspace quick links

* feat: endpoint to get recently active items

* Resolve conflicts

* Resolve conflicts

* Add filter to only list required entities

* Return required fields

* Add filter

* Add filter

* fix: remove emoji edit for uneditable pages (#6304)

* Removed duplicate imports

* feat: patch api

* Enable sort order to be updatable

* Return key name
only insert missing keys
use serializer to return data

* Remove random generation of sort_order

* Remove name field
Remove random generation of sort_order

---------

Co-authored-by: Bavisetti Narayan <[email protected]>
Co-authored-by: Vamsi Krishna <[email protected]>
Co-authored-by: gurusinath <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: Nikhil <[email protected]>
rahulsahay-shipsy pushed a commit to shipsy/plane that referenced this pull request Apr 10, 2025
* fix: adding language support package

* fix: language support implementation using mobx

* fix: adding more languages for support

* fix: profile settings translations

* feat: added language support for sidebar and user settings

* feat: added language support for deactivation modal

* fix: added project sync after transfer issues (makeplane#6200)

* code refactor and improvement (makeplane#6203)

* chore: package code refactoring

* chore: component restructuring and refactor

* chore: comment create improvement

* refactor: enhance workspace and project wrapper modularity (makeplane#6207)

* [WEB-2678]feat: added functionality to add labels directly from dropdown (makeplane#6211)

* enhancement:added functionality to add features directly from dropdown

* fix: fixed import order

* fix: fixed lint errors

* chore: added common component for project activity (makeplane#6212)

* chore: added common component for project activity

* fix: added enum

* fix: added enum for initiatives

* - Do not clear temp files that are locked. (makeplane#6214)

- Handle edge cases in sync workspace

* fix: labels empty state for drop down (makeplane#6216)

* refactor: remove cn helper function from the editor package (makeplane#6217)

* * feat: added language support to issue create modal in sidebar
* fix: project activity type

* * fix: added missing translations
* fix: modified translation for plurals

* fix: fixed spanish translation

* dev: language type error in space user profile types

* fix: type fixes

* chore: added alpha tag

---------

Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: gurusinath <[email protected]>
rahulsahay-shipsy pushed a commit to shipsy/plane that referenced this pull request Apr 11, 2025
* fix: adding language support package

* fix: language support implementation using mobx

* fix: adding more languages for support

* fix: profile settings translations

* feat: added language support for sidebar and user settings

* feat: added language support for deactivation modal

* fix: added project sync after transfer issues (makeplane#6200)

* code refactor and improvement (makeplane#6203)

* chore: package code refactoring

* chore: component restructuring and refactor

* chore: comment create improvement

* refactor: enhance workspace and project wrapper modularity (makeplane#6207)

* [WEB-2678]feat: added functionality to add labels directly from dropdown (makeplane#6211)

* enhancement:added functionality to add features directly from dropdown

* fix: fixed import order

* fix: fixed lint errors

* chore: added common component for project activity (makeplane#6212)

* chore: added common component for project activity

* fix: added enum

* fix: added enum for initiatives

* - Do not clear temp files that are locked. (makeplane#6214)

- Handle edge cases in sync workspace

* fix: labels empty state for drop down (makeplane#6216)

* refactor: remove cn helper function from the editor package (makeplane#6217)

* * feat: added language support to issue create modal in sidebar
* fix: project activity type

* * fix: added missing translations
* fix: modified translation for plurals

* fix: fixed spanish translation

* dev: language type error in space user profile types

* fix: type fixes

* chore: added alpha tag

---------

Co-authored-by: sriram veeraghanta <[email protected]>
Co-authored-by: Anmol Singh Bhatia <[email protected]>
Co-authored-by: Prateek Shourya <[email protected]>
Co-authored-by: Akshita Goyal <[email protected]>
Co-authored-by: Satish Gandham <[email protected]>
Co-authored-by: Aaryan Khandelwal <[email protected]>
Co-authored-by: gurusinath <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants